import java.io.*;
import java.net.*;
import java.util.concurrent.atomic.*;
public class ConnectionTest implements Runnable {

	int count = 0;
	int index = 0;
	private String url;
	long start = System.currentTimeMillis();
	
	public ConnectionTest(String url, int i){
		this.url = url; 
		index =i;
	}
	
	public void run(){
		try {
			
			URL myURL = new URL(url);
			
			HttpURLConnection myURLConnection = (HttpURLConnection) myURL.openConnection();
			
			myURLConnection.connect();
			
			BufferedReader d = new BufferedReader(new InputStreamReader(myURLConnection.getInputStream()));
            String inputLine;
            
            // reading content, comment out if just want to connect
            while ((inputLine = d.readLine()) != null) {
            //    System.out.println(inputLine);
            	if(inputLine.contains("SE_751")) System.out.println("yes");
            	
            }
            d.close();
       
//        //   increaseN();
//            long end = System.currentTimeMillis();
//            System.out.println("finsied in :" +(end-start)+" ms...");
//		//	System.out.println(myURLConnection.getResponseCode());
			
		} 
		catch (MalformedURLException e) { 
		    // new URL() failed
		    e.printStackTrace();
		    System.out.println( index + " " +url);
		} 
		catch (IOException e) {   
		    // openConnection() failed
		    e.printStackTrace();
		    System.out.println( index + " " + url);
		}
	}
	
	private synchronized void increase(){
		count++;
	}

}
